
const { ccclass, property } = cc._decorator;

@ccclass
export default class score extends cc.Component {

    private value: number = null;
    private sgring: cc.Label = null;
    static i: score = null;

    onLoad() {
        this.sgring = this.node.getComponent(cc.Label);
        this.disValue();
        score.i = this;   //赋值全局变量；

    }
    getScore() {
        return this.value;
    }
    //初始化显示分数为0
    disValue() {
        this.value = 0;
        this.sgring.string = this.value + '';
    }
    addScore(n: number) {
        this.value += n;
        this.sgring.string = this.value + '';
        console.log("");
    }
    start() {

    }

    // update (dt) {}
}
